import com.aspose.pdf.License;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author yujie
 * @createTime 2023/1/3 16:38
 * @description
 */
@Slf4j
public class main {

    public static void license() {
        InputStream licenseIs = null;
        try {
            licenseIs = main.class.getClassLoader().getResourceAsStream("Aspose.Total.Java.lic");
            License license = new License();
            license.setLicense(licenseIs);
            licenseIs = main.class.getClassLoader().getResourceAsStream("Aspose.Total.Java.lic");
            com.aspose.words.License wordAspose = new com.aspose.words.License();
            wordAspose.setLicense(licenseIs);
        } catch (Exception e) {
            log.error("There was an error setting the license: " + e.getMessage(), e);
        } finally {
            try {
                if(licenseIs != null){
                    licenseIs.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
